package org.test.updownload;

import org.apache.commons.fileupload.ProgressListener;
import org.apache.commons.httpclient.ContentLengthInputStream;

/**
 * listener,注意，实现了commons的接口，用来监测状态之类的，这里把其内容封装到status
 * 
 * @author game
 * 
 */
public class UploadListener implements ProgressListener {

	private UploadStatus status;

	public UploadListener(UploadStatus status) {
		this.status = status;
	}

	@Override
	public void update(long arg0, long arg1, int arg2) {
		// TODO Auto-generated method stub

		status.setBytesRead(arg0); //上传的流量
		status.setContentlength(arg1);//总
		status.setItems(arg2);   //第几个文件
		status.setUploaded(arg0/arg1); //上传的比率
	}

}
